package org.medusa.db;

import org.medusa.db.handlersocket.InsertResult;
import org.medusa.db.handlersocket.ModifyResult;
import org.medusa.db.handlersocket.QueryOneResult;
import org.medusa.db.handlersocket.QueryResult;

public interface IDatabase {
	public Error Connect(String host_r, int port_r, String host_wr, int port_wr);

	public Error Reconnect();

	public Error Auth(String port_passwd_r, String port_passwd_wr);

	public InsertResult Insert(String dbName, String tableName,
			String indexName, String[] columns, Object[] vals);

	public ModifyResult Modify(String dbName, String tableName,
			String indexName, String oper, Object[] cmpvals, String[] columns,
			Object[] newvals);

	public ModifyResult Modify(String dbName, String tableName,
			String indexName, String oper, Object[] cmpvals, String[] columns,
			Object[] newvals, int limit, int skip);

	public ModifyResult Remove(String dbName, String tableName,
			String indexName, String oper, Object[] cmpvals);

	public ModifyResult Remove(String dbName, String tableName,
			String indexName, String oper, Object[] cmpvals, int limit, int skip);

	public QueryResult Query(String dbName, String tableName, String indexName,
			String oper, Object[] keys, String[] columns, int limit, int skip);

	public QueryResult Query(String dbName, String tableName, String indexName,
			String oper, Object[] keys, String[] columns);

	public QueryOneResult QueryOne(String dbName, String tableName,
			String indexName, String oper, Object[] keys, String[] columns);

	public Error Close();
}
